Skip to content

Conversation

@ronodhirSoumik
Copy link
Contributor

Fixes #18157

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 14, 2025
Closes spring-projects#18157

Signed-off-by: Soumik Sarker <ronodhirsoumik@gmail.com>
@ronodhirSoumik ronodhirSoumik force-pushed the bugfix/fixed-npe-in-FilterChainProxy branch from 539fa3e to c8bd4d4 Compare November 14, 2025 19:39
Comment on lines +338 to +339
String requestMethod = request.getMethod();
return requestMethod != null && this.method.name().equals(requestMethod);
Copy link
Contributor

@ngocnhan-tran1996 ngocnhan-tran1996 Nov 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don’t need to check for null because this.method.name() will return a String type and String#equals(null) will return false, so the test passes without any changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but this fixes the NPE case - ig that is our expectation of getting false for invalid

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.method.name().equals(request.getMethod()) will return false if request.getMethod() == null and won’t throw an NPE unless request is null or method is null. The test passes without any changes.

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NPE in FilterChainProxy.getFilters(String)

3 participants